# Flow stability for dynamic community detection

This repository contain all the codes and scripts necessary to reproduce the results for the article "Flow stability for dynamic community detection" by Alexandre Bovet, Jean-Charles Delvenne & Renaud Lambiotte  (https://arxiv.org/abs/2101.06131)

The dataset of the primary school contact network can be downloaded at http://www.sociopatterns.org/datasets/. 
The dataset of the wild mice contact network can be downloaded at http://doi.org/10.5281/zenodo.4725155.
Processed data for the APS dataset is stored in `data/aps` and the raw data can be found at https://journals.aps.org/datasets.

The results of the flow stability applied to the empirical datasets in the article are stored in JSON files in `data`.

The scripts to reproduce the results based on these datasets are in `scripts`

# Requirements:
- Python3 (>=3.6)
- pandas
- scipy
- numpy
- Cython (optional but highly recommended)
- [sparse_dot_mkl](https://github.com/flatironinstitute/sparse_dot) (optional, allows to perform multithreaded sparse matrix multiplication)
- graph_tool (only used to aggregate temporal networks in a static network and to draw some results)
- cycler
- infomap
- hickle
- psutil (optional, used to print memory usage)
- tqdm
- regex
- MajorTrack (https://github.com/j-i-l/MajorTrack)
- matplotlib
- palettable
- networkx
- floweaver (https://github.com/ricklupton/floweaver)
- leidenalg
- flashgeotext
- geopy
- jellyfish
- nltk (for extracting countries from affiliations in the APS dataset)
- python_igraph
- wquantiles


Run `python setup.py build_ext --inplace` to compile the cython functions.

